package may.test_5_28;

import java.util.Scanner;

public class TestMain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String[] strings = new String[n];
        for (int i = 0; i < n; i++) {
            strings[i] = scanner.nextLine();
        }
        int[][] arr = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                arr[i][j] = strings[i].charAt(j) - '0';
            }
        }
        int[][] dp = new int[n][n];
        for (int i = 1; i <= n; i++) {
            perfect(dp,arr,i);
        }
    }
    public static void perfect(int[][] dp,int[][] arr,int k) {
        int count = 0;
        int n = arr.length;
        for (int i = 0; i <= n - k; i++) {
            for (int j = 0; j <= n - k; j++) {
                reresult(dp,arr,i,j,k);
                if(dp[i][j] * 2 == k * k) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
    private static void reresult(int[][] dp,int[][] arr,int m,int n,int k) {
        int count = 0;
        for (int i = 0 ; i < k; i++) {
            count += arr[m + k - 1][n + i];
            count += arr[m + i][n + k - 1];
        }
        count -= arr[m + k - 1][n + k - 1];
        dp[m][n] += count;
    }
}
